<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

	<title>Wizard Demo</title>

	<!-- required: a default theme file, and Wizard styles -->
	<link rel="stylesheet" id="themeStyles" href="../../../dijit/themes/tundra/tundra.css">
	<link rel="stylesheet" href="../Wizard/Wizard.css">
	
	<!-- required: dojo.js -->
	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script>

	<!-- do not use! only for testing dynamic themes -->
	<script type="text/javascript" src="../../../dijit/tests/_testCommon.js"></script>
	<!-- for debugging: -->
	<script type="text/javascript" src="../Wizard.js"></script>

	<script type="text/javascript">
		dojo.require("dojox.widget.Wizard");
	
		dojo.require("dijit.layout.AccordionContainer");
		dojo.require("dijit.layout.ContentPane");
		dojo.require("dijit.layout.TabContainer");
		dojo.require("dijit.layout.BorderContainer");
		
		function cancel() {
			alert("Wizard Cancelled!");
		}
	    
		function done() {
			alert("Wizard Done!");
		}
		
		var programatic_Example = function(){
			
			var wizard = new dojox.widget.Wizard({
				style:"width:300px; height:300px"
			}).placeAt(dojo.body(),"last");
			
			var contents = [
				"Pane 1 content", "Pane 2 content", "<h3>Done!</h3>"
			];
			
			dojo.forEach(contents, function(term){
			
				new dojox.widget.WizardPane({})
					.placeAt(wizard)
					.attr("content", term)
				;
			});
			wizard.startup();
			
		}
		
		dojo.addOnLoad(programatic_Example)
	</script>

	<style type="text/css">
		@import "../../../dijit/tests/css/dijitTests.css"; 
		body {
			font-family : sans-serif;
		}
	</style>
</head>

<body class="tundra">

	<div style="width:800px; margin:0 auto">

		<h1 class="testTitle">dojox.widget.Wizard tests</h1>

		<p>This example shows a wizard with customized button labels.</p>

		<div id="wizard1" dojoType="dojox.widget.Wizard"
			 style="width: 640px; height: 200px;"
			 nextButtonLabel="Go on"
			 >
			<div dojoType="dojox.widget.WizardPane" title="Tab 1">
				<h1>Tab 1</h1>
				<p>Sized content, box one</p>
			</div>
			<div dojoType="dojox.widget.WizardPane">
				<h1>Tab 2</h1>
			</div>
			<div dojoType="dojox.widget.WizardPane">
				<h1>Tab 3</h1>
	
				You won't be able to come back, but you can finish now...
				<script type='dojo/method' event="doneFunction">
					done();
					console.log('inline done function called');
				</script>
			</div>
			<div dojoType="dojox.widget.WizardPane" canGoBack="false">
				<h1>Tab 4</h1>
	
				... and now you can't go back.
			</div>
			<div dojoType="dojox.widget.WizardPane" doneFunction="done">
				<h1>Tab 5</h1>
				... and now you can finish up.
			</div>
			<script type="dojo/method" event="cancelFunction">
				alert("dojo/method cancel function on container! bye.")
				this.destroy();
			</script>
		</div>
	
		<p>The next shows the option to hide the inactive buttons, with a smaller width...</p>
	
		<div id="wizard2" dojoType="dojox.widget.Wizard" hideDisabled="true" style="width: 50%; height: 200px;">
			<div dojoType="dojox.widget.WizardPane">
				<h1>Step 1 of 3</h1>
				<p>Lorem ipsum dolor sit amet</p>
			</div>
			<div dojoType="dojox.widget.WizardPane">
				<h1>Step 2 of 3</h1>
				<p>consectetur adipisicing elit</p>
			</div>
			<div dojoType="dojox.widget.WizardPane">
				<h1>Step 3 of 3</h1>
				<p>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p>
			</div>
		</div>

		<p>Layout Children</p>
		<div id="wizard2lay" dojoType="dojox.widget.Wizard" hideDisabled="true" style="width: 50%; height: 240px;">
			<div dojoType="dojox.widget.WizardPane">
				<p>The next two (hidden) children container AccordionContainers. You'll have to be
					more careful about the styling / sizing, as the child wants to take 100% of
					it's height. You can size explicitly if you like, or add margin-bottom to
					leave room for the buttons
				</p>
			</div>
			<div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
				<div dojoType="dijit.layout.AccordionContainer">
					<div title="foo" dojoType="dijit.layout.ContentPane">
						foo.
					</div>
					<div title="bar" dojoType="dijit.layout.ContentPane">
						foo.
					</div>
				</div>				
			</div>
			<div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
				<div dojoType="dijit.layout.BorderContainer">
					<div region="left" style="width:75px" dojoType="dijit.layout.ContentPane">
						left pane
					</div>
					<div region="center" dojoType="dijit.layout.ContentPane">
						main pane
					</div>
					<div dojoType="dijit.layout.ContentPane" region="right" style="width:75px">
						right pane
					</div>
				</div>
			</div>
			<div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
				<div dojoType="dijit.layout.TabContainer">
					<div title="tab1" dojoType="dijit.layout.ContentPane">
						foo
					</div>
					<div title="tab2" dojoType="dijit.layout.ContentPane">
						foo
					</div>
					<div title="tab3" dojoType="dijit.layout.ContentPane">
						foo
					</div>
				</div>
			</div>
			
			
		</div>

	
		<p>The next shows blocking moving to the next step with a JS function...</p>
	
		<script>
			function checkAgreement() {
				var frm = document.forms['acceptAgreement'];
				var accept = frm.accept;
				if (!accept.checked) {
					return "You must agree to the terms before continuing.";
				}
			}
		</script>
		<div id="wizard3" dojoType="dojox.widget.Wizard" style="width: 600px; height: 400px; margin:0 auto;">
			<div dojoType="dojox.widget.WizardPane" id="Agreement1" passFunction="checkAgreement">
				<h1>Agreement Terms</h1>
	
				<div dojoType="dijit.layout.ContentPane" style="width:400px; border:1px solid #b7b7b7; background:#fff; padding:8px; margin:0 auto; height:200px; overflow:auto; "
					href="../../../dojo/LICENSE"></div>
	
				<form action="#" name="acceptAgreement">
					<p>
					<input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement.
					</p>
				</form>
			</div>
			<div dojoType="dojox.widget.WizardPane" canGoBack="false">
				<h1>Complete</h1>
				<p>The license has been accepted.</p>
			</div>
		</div>

			<h2>Another like above, but with dojo/method passFunction</h2>
			<div id="wizard4" dojoType="dojox.widget.Wizard" style="width: 600px; height: 400px; margin:0 auto;">
				<div dojoType="dojox.widget.WizardPane" id="Agreement12">
					<script type="dojo/method" event="passFunction">
						return "cant do that yet";
					</script>
					<h1>Agreement Terms</h1>

					<div dojoType="dijit.layout.ContentPane" style="width:400px; border:1px solid #b7b7b7; background:#fff; padding:8px; margin:0 auto; height:200px; overflow:auto; "
						href="../../../dojo/LICENSE"></div>

					<form action="#" name="acceptAgreement">
						<p>
						<input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement.
						</p>
					</form>
				</div>
				<div dojoType="dojox.widget.WizardPane" canGoBack="false">
					<h1>Complete</h1>
					<p>The license has been accepted.</p>
				</div>
			</div>
			
	</div>

</body>
</html>


